package com.ydd.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.pagehelper.Page;
import com.ydd.dto.LoginAndRegDTO;
import com.ydd.dto.SYSUserPageQueryDTO;
import com.ydd.entity.SysUser;
import com.ydd.entity.YddUser;
import com.ydd.vo.SysUserPage;
import com.ydd.vo.SysUserPageVO;
import com.ydd.vo.SysUserVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Description TODO
 * @Author fang
 * @Date 2023-05-29 16:09
 */
@Mapper
public interface SysUserMapper extends BaseMapper<SysUser> {
    /**
     * AdminIndexService-baseInfo
     * @return
     */
    @Select("select count(*) from sys_user")
    Integer getAdminNum();

    /**
     * AdminIndexService-profile
     * @param id
     * @return
     */
    @Select("select * from sys_user where id=#{id}")
    SysUser getById(String id);

    /**
     * AdminIndexService-findByCondition
     * @param loginAndRegDTO
     * @return
     */
    SysUser findByCondition(LoginAndRegDTO loginAndRegDTO);
    /**
     * 新增管理员
     * @param sysUser
     */
    void userAdd(SysUser sysUser);

    /**
     * 查询角色
     * @param roleId
     * @return
     */
    List<String> getRoleId(List<String> roleId);

    /**
     * 查询用户总数
     * @param sysUserPageQueryDTO
     * @return
     */
    Integer count(SYSUserPageQueryDTO sysUserPageQueryDTO);

    /**
     * 分页查询
     * @param sysUserPageQueryDTO
     * @return
     */
    Page<SysUserPage> Pagedad(SYSUserPageQueryDTO sysUserPageQueryDTO);

    /**
     * 删除管理员
     * @param id
     */
    @Delete("delete from sys_user where id=#{id}")
    void del(String id);

    SysUserVO getUser(String id);
    void upUser(SysUser sysUser);


    List<String> getrole(String[] roleNameId);
}
